//
//  MyCollectionViewCell.m
//  ZhiHuiLiJiang
//
//  Created by work on 2018/11/13.
//  Copyright © 2018年 王雅鹏. All rights reserved.
//首页推荐菜单的cell

#import "MyCollectionViewCell.h"
#import "BYHomeRecommendMenuModel.h"//首页推荐菜单的model

@interface MyCollectionViewCell()
/**图片*/
@property (strong, nonatomic) UIImageView *topImage;
/**文字*/
@property (strong, nonatomic) UILabel *botlabel;

@end
@implementation MyCollectionViewCell
- (id)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self){
        [self.contentView addSubview:self.topImage];
        [self.contentView addSubview:self.botlabel];
        [self.botlabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.contentView.mas_centerX);
            make.bottom.equalTo(self.contentView.mas_bottom).with.offset(BY_Height(-16));
        }];
        [self.topImage mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerX.equalTo(self.contentView.mas_centerX);
            make.bottom.equalTo(self.botlabel.mas_top).with.offset(BY_Height(-16));
            make.size.mas_equalTo(CGSizeMake(BY_Width(60), BY_Width(60)));
        }];
        
    }
    return self;
}
- (UIImageView *)topImage{
    if (!_topImage) {
        _topImage = [[UIImageView alloc]init];
    }
    return _topImage;
}
- (UILabel *)botlabel{
    if (!_botlabel) {
        _botlabel = [[UILabel alloc]init];
        _botlabel.font = BYPTFont28;
        _botlabel.textColor = RGBA(40, 40, 40, 1.0);
        [_botlabel sizeToFit];
    }
    return _botlabel;
}
- (void)setHomeMenuModel:(BYHomeRecommendMenuModel *)homeMenuModel{
    _homeMenuModel = homeMenuModel;
    self.botlabel.text = _homeMenuModel.name;//@"充值中心";
    if ([homeMenuModel.name isEqualToString:@"全部"]) {
       self.topImage.image =[UIImage imageNamed:@"homeThird_whole"];
    }
    else{
        [self.topImage sd_setImageWithURL:[NSURL URLWithString:_homeMenuModel.img] placeholderImage:[UIImage imageNamed:@""]];
    }
}


@end
